﻿<?php
session_start();

if (!isset($_SESSION['login']) && !$_SESSION['login'] == true) {
	header ("Location: index.php");
}


include 'config.php';
mysqli_set_charset($con, 'utf8');

?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<link rel="stylesheet" type="text/css" href="style.css" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="scripts/jquery.tablesorter.js"></script>
<script src="scripts/lang/lang_se.js"></script>

<title>Sales Makeover</title>

</head>

<body>
	<div class="bodyLeft" id="bodyLeft">
		<?php include("menu.html"); ?>
	</div>
	<div class="bodyRight" id="bodyRight">
		<div class="container_head">
			<?php include("header.html"); ?>
		</div>
		<div class="container" id="container">
			<div class="content">
				<p style='margin-left:10px;'class="tr" key="ListInnovation_Info"></p><br/>
				
				<?php
				$companyID = $_SESSION['companyID'];
				$sql = "SELECT Innovation.Name AS InnoName, Innovation.ID AS InnoID, CustomerName FROM Innovation INNER JOIN (SELECT User.ID, Company.ID as CompanyID, Company.Name AS CompanyName FROM User INNER JOIN Company ON User.CompanyID = Company.ID) AS T1 ON Innovation.OwnerID = T1.ID AND T1.CompanyID = '$companyID'";
				
				$result = mysqli_query($con,$sql);
				
				while($row = mysqli_fetch_array($result))
				{
					echo "<a href='showInnovation.php?ID=" . $row['InnoID'] . "'><div style='border-top: 1px solid #333333;'>";
						echo "<div style='margin-left:10px;display: inline-block;position:relative; '>";
						echo "<span style='display:inline-block; vertical-align:middle;line-height:30px;'>";
						echo "<b>" . $row['CustomerName'] . "</b>";
						echo "<br/>";
						echo $row['InnoName'];
						echo "</div>";
						echo "<div id='innovation_links' style='float:right;display:inline-block; vertical-align: middle;margin-top:15px; '>";
						echo "<img src='content/icons/icon_view_default.png' />";
						echo "</span>";
						echo "</div>";
					echo "</div></a>";
				}
				echo "<div style='border-top: 1px solid #333333;'></div>";
				mysqli_close($con);
				
				?>
			</div>
		</div>
	</div>
	<?php if(isset($_SESSION["Popup"])){ $message = $_SESSION['Popup']; echo "<script type='text/javascript'>alert('$message');</script>"; unset($_SESSION['Popup']);} ?>
</body>

</html>
